 /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.fsj.spring.util;

import com.pclong.config.FileListener;
import com.pclong.config.FileMonitor;
import com.pclong.config.FileObserver;
import javax.servlet.*;  
import javax.servlet.http.*;  
import java.io.*;  
import java.util.*; 
/**
 *
 * @author Administrator
 */
public class InitServlet extends HttpServlet{
    
     public void init() throws ServletException {  
    // TODO Auto-generated method stub  
        FileObserver ob = new FileObserver("E:\\temp\\1");
        FileListener listener = new FileListener();  
        ob.addListener(listener);  
        FileMonitor monitor = new FileMonitor(ob);  
        monitor.start();  
    Thread t=new Thread(){  
        public void run(){  
            try{  
               while(true){  
                  System.out.println("init begin");  
                  System.out.flush();  
                  sleep(10000);  
               }  
            }catch(Exception ex){}  
        }  
    };   
    t.start();  
  }  
  
  
  /* (non-Javadoc) 
   * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 
   */  
  protected void service(HttpServletRequest arg0, HttpServletResponse arg1)  
   throws ServletException, IOException {  
    // TODO Auto-generated method stub  
    //System.out.println(" init server begin");  
  }   
}
